package serializer

import "study_abroad_system_back_end/models"

// CollegeInfo 院校详细信息结构体
/*
type CollegeInfo struct {
	ID                int     `json:"id"`
	College_name      string  `json:"college_name"`      //学校中文名称
	College_e_name    string  `json:"college_e_name"`    //学校英文名称
	Img_path          string  `json:"img_path"`          //图片路径
	Country           string  `json:"country"`           //所在国家
	Area              string  `json:"area"`              //所在地区
	Qs_rank           int     `json:"qs_rank"`           //QS排名
	Acceptance_rate   float32 `json:"acceptance_rate"`   //录取率
	Local_rank        int     `json:"local_rank"`        //所在国家排名
	Introduction      string  `json:"introduction"`      //学校简介
	Total_student_num int     `json:"total_student_num"` //总学生数
	Undergraduate     int     `json:"undergraduate"`     //本科生数
	Graduate          int     `json:"graduate"`          //研究生数
	EA                string  `json:"ea"`                //EA申请截止时间
	RD                string  `json:"rd"`                //RD申请截止时间
	Undergraduate_gpa float32 `json:"undergraduate_gpa"` //本科GPA要求
	IELTS             float32 `json:"ielts"`             //雅思成绩
	TOEFL             int     `json:"toefl"`             //托福成绩
	SAT               int     `json:"sat"`               //SAT成绩要求
	Tuition_fee       int     `json:"tuition_fee"`       //学费
	Living_fee        int     `json:"living_fee"`        //生活费
}

// BuildCollege 院校详细信息
func BuildCollege(college models.College) CollegeInfo {
	return CollegeInfo{
		ID:                college.ID,
		College_name:      college.College_name,
		College_e_name:    college.College_e_name,
		Img_path:          college.Img_path,
		Country:           college.Country,
		Area:              college.Area,
		Qs_rank:           college.Qs_rank,
		Acceptance_rate:   college.Acceptance_rate,
		Local_rank:        college.Local_rank,
		Introduction:      college.Introduction,
		Total_student_num: college.Total_student_num,
		Undergraduate:     college.Undergraduate,
		Graduate:          college.Graduate,
		EA:                college.EA,
		RD:                college.RD,
		Undergraduate_gpa: college.Undergraduate_gpa,
		IELTS:             college.IELTS,
		TOEFL:             college.TOEFL,
		SAT:               college.SAT,
		Tuition_fee:       college.Tuition_fee,
		Living_fee:        college.Living_fee,
	}
}

// CollegeListInfo 院校列表元素结构体
type CollegeListInfo struct {
	ID int `json:"id"`
	College_name string `json:"college_name"`
	Img_path string `json:"img_path"`
	Country string `json:"country"`
	Introduction string `json:"introduction"`
}

// BuildCollegeList 院校列表
func BuildCollegeList(college models.College) CollegeListInfo {
	return CollegeListInfo{
		ID:                college.ID,
		College_name:      college.College_name,
		Img_path:          college.Img_path,
		Country:           college.Country,
		Introduction:      college.Introduction,
	}
}

// BuildCollegesList 序列化学校列表
func BuildCollegesList(items []models.College) (colleges []CollegeListInfo) {
	for _, item := range items {
		college := BuildCollegeList(item)
		colleges = append(colleges, college)
	}
	return colleges
}
*/
type CollegeInfo struct {
	Id        int     `json:"id,omitempty"`
	Name      string  `json:"name,omitempty"`
	Country   string  `json:"country,omitempty"`
	Overall   float32 `json:"overall,omitempty"`
	Teaching  float32 `json:"teaching,omitempty"`
	Research  float32 `json:"research,omitempty"`
	Citations float32 `json:"citations,omitempty"`
	Industry  float32 `json:"industry,omitempty"`
	Outlook   float32 `json:"outlook,omitempty"`
	Rank1     int     `json:"rank_1,omitempty"`
	Rank2     int     `json:"rank_2,omitempty"`
	Rank3     int     `json:"rank_3,omitempty"`
	Rank4     int     `json:"rank_4,omitempty"`
	Rank5     int     `json:"rank_5,omitempty"`
	Rank6     int     `json:"rank_6,omitempty"`
	Types     string  `json:"types,omitempty"`
	Netprice  int     `json:"netprice,omitempty"`
	Passrate  float32 `json:"passrate,omitempty"`
	Students  int     `json:"students,omitempty"`
	Gradrate  float32 `json:"gradrate,omitempty"`
	Picture   string  `json:"picture,omitempty"`
}

// BuildCollege 院校详细信息
func BuildCollege(college models.College) CollegeInfo {
	return CollegeInfo{
		Id:        college.Id,
		Name:      college.Name,
		Country:   college.Country,
		Overall:   college.Overall,
		Teaching:  college.Teaching,
		Research:  college.Research,
		Citations: college.Citations,
		Industry:  college.Industry,
		Outlook:   college.Outlook,
		Rank1:     college.Rank1,
		Rank2:     college.Rank2,
		Rank3:     college.Rank3,
		Rank4:     college.Rank4,
		Rank5:     college.Rank5,
		Rank6:     college.Rank6,
		Types:     college.Types,
		Netprice:  college.Netprice,
		Passrate:  college.Passrate,
		Students:  college.Students,
		Gradrate:  college.Gradrate,
		Picture:   college.Picture,
	}
}

// CollegeListInfo 院校列表元素结构体
type CollegeListInfo struct {
	Id      int     `json:"id,omitempty"`
	Name    string  `json:"college_name,omitempty"`
	Country string  `json:"country,omitempty"`
	Overall float32 `json:"overall,omitempty"`
	Picture string  `json:"picture,omitempty"`
	Rank1   int     `json:"rank_1"`
	Rank2   int     `json:"rank_2"`
	Rank3   int     `json:"rank_3"`
	Rank4   int     `json:"rank_4"`
	Rank5   int     `json:"rank_5"`
	Rank6   int     `json:"rank_6"`
}

// BuildCollegeList 院校列表
func BuildCollegeList(college models.College) CollegeListInfo {
	return CollegeListInfo{
		Id:      college.Id,
		Name:    college.Name,
		Country: college.Country,
		Overall: college.Overall,
		Picture: college.Picture,
		Rank1:   college.Rank1,
		Rank2:   college.Rank2,
		Rank3:   college.Rank3,
		Rank4:   college.Rank4,
		Rank5:   college.Rank5,
		Rank6:   college.Rank6,
	}
}

// BuildCollegesList 序列化学校列表
func BuildCollegesList(items []models.College) (colleges []CollegeListInfo) {
	for _, item := range items {
		college := BuildCollegeList(item)
		colleges = append(colleges, college)
	}
	return colleges
}

// CollegeRank0Info 院校工程技术排名
type CollegeRank0Info struct {
	Id      int     `json:"id,omitempty"`
	Name    string  `json:"college_name,omitempty"`
	Overall float32 `json:"Overall,omitempty"`
	Picture string  `json:"picture,omitempty"`
	Rank1   int     `json:"rank_1"`
}
func BuildCollegeRank0(college models.College) CollegeRank0Info {
	return CollegeRank0Info{
		Id: 	 college.Id,
		Name:    college.Name,
		Overall: college.Overall,
		Picture: college.Picture,
		Rank1:   college.Rank1,
	}
}
func BuildCollegesRank0(items []models.College) (colleges []CollegeRank0Info) {
	i:=0
	for _, item := range items {
		college := BuildCollegeRank0(item)
		colleges = append(colleges, college)
		i++
		if i==20{
			break
		}
	}
	return colleges
}

// CollegeRank1Info 院校医学保健排名
type CollegeRank1Info struct {
	Id      int     `json:"id,omitempty"`
	Name    string  `json:"college_name,omitempty"`
	Overall float32 `json:"Overall,omitempty"`
	Picture string  `json:"picture,omitempty"`
	Rank2   int     `json:"rank_2"`
}
func BuildCollegeRank1(college models.College) CollegeRank1Info {
	return CollegeRank1Info{
		Id: 	 college.Id,	
		Name:    college.Name,
		Overall: college.Overall,
		Picture: college.Picture,
		Rank2:   college.Rank2,
	}
}
func BuildCollegesRank1(items []models.College) (colleges []CollegeRank1Info) {
	i:=0
	for _, item := range items {
		college := BuildCollegeRank1(item)
		colleges = append(colleges, college)
		i++
		if i==20{
			break
		}
	}
	return colleges
}

// CollegeRank2Info 院校社会科学排名
type CollegeRank2Info struct {
	Id      int     `json:"id,omitempty"`
	Name    string  `json:"college_name,omitempty"`
	Overall float32 `json:"Overall,omitempty"`
	Picture string  `json:"picture,omitempty"`
	Rank3   int     `json:"rank_3"`
}
func BuildCollegeRank2(college models.College) CollegeRank2Info {
	return CollegeRank2Info{
		Id: 	 college.Id,
		Name:    college.Name,
		Overall: college.Overall,
		Picture: college.Picture,
		Rank3:   college.Rank3,
	}
}
func BuildCollegesRank2(items []models.College) (colleges []CollegeRank2Info) {
	i:=0
	for _, item := range items {
		college := BuildCollegeRank2(item)
		colleges = append(colleges, college)
		i++
		if i==20{
			break
		}
	}
	return colleges
}

// CollegeRank3Info 院校生命科学排名
type CollegeRank3Info struct {
	Id      int     `json:"id,omitempty"`
	Name    string  `json:"college_name,omitempty"`
	Overall float32 `json:"Overall,omitempty"`
	Picture string  `json:"picture,omitempty"`
	Rank4   int     `json:"rank_4"`
}
func BuildCollegeRank3(college models.College) CollegeRank3Info {
	return CollegeRank3Info{
		Id:  	 college.Id,
		Name:    college.Name,
		Overall: college.Overall,
		Picture: college.Picture,
		Rank4:   college.Rank4,
	}
}
func BuildCollegesRank3(items []models.College) (colleges []CollegeRank3Info) {
	i:=0
	for _, item := range items {
		college := BuildCollegeRank3(item)
		colleges = append(colleges, college)
		i++
		if i==20{
			break
		}
	}
	return colleges
}

// CollegeRank4Info 院校物理科学排名
type CollegeRank4Info struct {
	Id      int     `json:"id,omitempty"`
	Name    string  `json:"college_name,omitempty"`
	Overall float32 `json:"Overall,omitempty"`
	Picture string  `json:"picture,omitempty"`
	Rank5   int     `json:"rank_5"`
}
func BuildCollegeRank4(college models.College) CollegeRank4Info {
	return CollegeRank4Info{
		Id: 	 college.Id,
		Name:    college.Name,
		Overall: college.Overall,
		Picture: college.Picture,
		Rank5:   college.Rank5,
	}
}
func BuildCollegesRank4(items []models.College) (colleges []CollegeRank4Info) {
	i:=0
	for _, item := range items {
		college := BuildCollegeRank4(item)
		colleges = append(colleges, college)
		i++
		if i==20{
			break
		}
	}
	return colleges
}

// CollegeRank5Info 院校人文科学排名
type CollegeRank5Info struct {
	Id      int     `json:"id,omitempty"`
	Name    string  `json:"college_name,omitempty"`
	Overall float32 `json:"Overall,omitempty"`
	Picture string  `json:"picture,omitempty"`
	Rank6   int     `json:"rank_6"`
}
func BuildCollegeRank5(college models.College) CollegeRank5Info {
	return CollegeRank5Info{
		Id: 	 college.Id,
		Name:    college.Name,
		Overall: college.Overall,
		Picture: college.Picture,
		Rank6:   college.Rank6,
	}
}
func BuildCollegesRank5(items []models.College) (colleges []CollegeRank5Info) {
	i:=0
	for _, item := range items {
		college := BuildCollegeRank5(item)
		colleges = append(colleges, college)
		i++
		if i==20{
			break
		}
	}
	return colleges
}